package org.hp.controller;

import org.hp.bean.Admin;
import org.hp.service.login.LoginService;
import org.hp.util.Layui;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

@Controller
public class LoginContraller {
    Layui layui=new Layui();

    @Resource
    LoginService loginService;

    @RequestMapping("/alogin")
    public void login(Admin admin, HttpServletRequest request, HttpServletResponse response) throws IOException {
        Map map=loginService.login(admin);
        if (map!=null){
            //request.getSession().setAttribute("map",map);
            response.getWriter().write("yes");
        }else {
            response.getWriter().write("no");
        }
    }
}